// Copyright (c) Microsoft Corporation. 
// Licensed under the MIT license.

#pragma once
/*=============================================================================
SimplygonSettings.h: Declares the USimplygonSettings class.
=============================================================================*/
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "Engine/EngineTypes.h"
#include "Engine/ImportantToggleSettingInterface.h"
#include "SimplygonSettings.generated.h"

/**
* Enum describing the remeshing processor to use.
*/
UENUM()
enum class ERemeshingProcessorVersion
{
	Default UMETA(DisplayName = "Default", ToolTip = "Remesher introduced in 9.0"),
	Legacy	 UMETA(DisplayName= "Legacy", ToolTip = "Legacy remesher is deprecated and will be removed in future release. ")
};

/**
* Enum describing the tangent space generation method use
*/
UENUM()
enum class EDefaultTNBSimplygon
{
	/// 
	OrthonormalRightHanded = 0 UMETA(DisplayName = "Right(Orthonormal)", ToolTip = "Standard method, creates an orthonormal tangent space (right-handed)"),

	/// 
	Autodesk3dsMax = 1 UMETA(DisplayName="3dsMax", ToolTip = "3dsMax compatible method, creates tangent space that is compatible with the 3dsMax renderer"),

	/// 
	OrthonormalLeftHanded = 2 UMETA(DisplayName="Left(Orthonormal)", ToolTip = "Creates an orthonormal tangent space (left-handed, D3D compatible, UE compatible)"),

	/// 
	MikkTSpace = 3 UMETA(DisplayName="MikkTSpace", ToolTip = "Creates a tangent space using the MikkTSpace tangent space generation algorithm. (UE compatible)")
};

/**
* Enum describing the distribution method to use
*/
UENUM()
enum class EDistributionMethod
{
	/// 
	SimplygonGrid = 0 UMETA(DisplayName = "Simplygon Grid", ToolTip = "Standard method, uses Simplygon Grid"),

	/// 
	FastBuild = 1 UMETA(DisplayName="FASTBuild", ToolTip = "Use FASTBuild"),

	/// 
	Incredibuild = 2 UMETA(DisplayName="Incredibuild", ToolTip = "Use Incredibuild")
};

/**
* Implements the settings for the Simplygon Plugin.
*/
UCLASS(config=Engine, defaultconfig)
class SIMPLYGONCONTENT_API USimplygonSettings : public UObject
	/*, public IImportantToggleSettingInterface*/
{
	GENERATED_UCLASS_BODY()

public:

	/** License search paths. First match in chronological order will be used. */
	UPROPERTY(EditAnywhere, config, Category = General, meta = (ConfigRestartRequired = true))
	TArray<FFilePath> LicensePaths;

	/** Will use distribution if enabled.*/
	UPROPERTY(EditAnywhere, config, Category = "Simplygon API", meta = (ConfigRestartRequired = false))
	bool UseDistribution;

	/** Which distribution method to use if distribution is enabled. */
	UPROPERTY(EditAnywhere, config, Category = "Simplygon API", meta = (ConfigRestartRequired = false))
	EDistributionMethod DistributionMethod;

	/** Preferred version of the remeshing processor, default is set to use the newer version.	*/
	UE_DEPRECATED(4.27, "PreferredRemesher for Simplygon 10 has been removed. Will default to the new Remesher.")
	UPROPERTY()
	ERemeshingProcessorVersion PreferredRemesher_DEPRECATED;

	/** Enable debuging for Simplygon Plugin. */
	UPROPERTY(EditAnywhere, config, Category = General, meta = (ConfigRestartRequired = true))
	bool bDebug;

	/** If bDebug is enabled and this flag is set will export a sgscene and pipeline when processing.*/
	UPROPERTY(EditAnywhere, config, Category = General, meta = (ConfigRestartRequired = true, EditCondition="bDebug"))
	bool bExportPipelineAndScene;

	/** Path where debug data will be save. Default Project/Intermediate/Simplygon */
	UPROPERTY(EditAnywhere, config, Category = General, meta = (ConfigRestartRequired = true, EditCondition = "bDebug"))
	FDirectoryPath DebugPath;

	/** Which tangent space generation method to use. */
	UPROPERTY(EditAnywhere, config, Category = SimplygonGlobal, meta = (ConfigRestartRequired = false))
	EDefaultTNBSimplygon Tangentspace;

	/** The wait interval between telemtry data sends to Simplygon DLL. Note the Simplygon DLL decides if telemetry will be uploaded or not baseed on license key */
	UPROPERTY()
	int32 SendInterval;

	/** After LOD Generation of StaticMeshes calculate bound of mesh description and update negative/positive bounds extension. */
	UPROPERTY(EditAnywhere, config, Category = General, meta = (ConfigRestartRequired = false))
	bool bAdjustLODBounds;

public:

	/**
	 * @brief Get license path.
	 * @return Directory path to Simplygon License
	*/
	FString GetLicensePath() const;

	// BEGIN IImportantToggleSettingInterface
	//virtual void GetToggleCategoryAndPropertyNames(FName& OutCategory, FName& OutProperty) const override;
	//virtual FText GetFalseStateLabel() const override;
	//virtual FText GetFalseStateTooltip() const override;
	//virtual FText GetFalseStateDescription() const override;
	//virtual FText GetTrueStateLabel() const override;
	//virtual FText GetTrueStateTooltip() const override;
	//virtual FText GetTrueStateDescription() const override;
	//virtual FString GetAdditionalInfoUrl() const override;
	//virtual FText GetAdditionalInfoUrlLabel() const override;
	// END IImportantToggleSettingInterface

};
